﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JSC.Portal.Entities;
using JSC.Portal.Services;
using JSC.Core.Data;

namespace JSC.Portal.Data
{
    public class PortalSiteService : CommonDao<PortalSite>, IPortalSiteService
    {
        #region IPortalSiteService Members

        public IList<PortalSite> GetPortalSites()
        {
            return GetAll();
        }

        public PortalSite GetPortalSiteByUrl(string url)
        {
            string hql = "from PortalSite ps where lower(ps.Url) = :url";
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("url", url.ToLowerInvariant());
            return GetUniqueByQuery(hql, parameters);
        }

        #endregion
    }
}
